public class Demo11 {
    public static int result = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            int sum = 0;
            for (int i = 0; i <= 1000; i++) {
                sum += 1;
            }

            result = sum;
        });
        t.start();

        t.join();
        System.out.println(result);
    }
}
